"""
营销短信脚本
"""
import os
import sys
import django

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.extend([BASE_DIR, ])
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "finance_c2c.settings")
django.setup()
from core.tools.mysql_connect import SqlModel
from core.tools.short_message import ShortMessage


class SendSalesMessage(SqlModel, ShortMessage):
    def __init__(self):
        super(SendSalesMessage, self).__init__(database="bak")

    def send_msg(self):
        sql = "SELECT count(DISTINCT(`mobile`))  FROM `bxweb_online_bak`.`core_peopleinfo` ;"
        self.cursor.execute(sql)
        result = self.cursor.fetchall()
        for i in result:
            print(i[0])

            # cls.sales_msg(tel, appId, appKey, template_id)


if __name__ == '__main__':
    send = SendSalesMessage()
    send.send_msg()
